package com.ruoyi.cat.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cat.mapper.CatCartMapper;
import com.ruoyi.cat.domain.CatCart;
import com.ruoyi.cat.service.ICatCartService;

/**
 * 购物车信息Service业务层处理
 * 
 * @author xin
 * @date 2025-09-16
 */
@Service
public class CatCartServiceImpl implements ICatCartService 
{
    @Autowired
    private CatCartMapper catCartMapper;

    /**
     * 查询购物车信息
     * 
     * @param cartid 购物车信息主键
     * @return 购物车信息
     */
    @Override
    public CatCart selectCatCartByCartid(Long cartid)
    {
        return catCartMapper.selectCatCartByCartid(cartid);
    }

    /**
     * 查询购物车信息列表
     * 
     * @param catCart 购物车信息
     * @return 购物车信息
     */
    @Override
    public List<CatCart> selectCatCartList(CatCart catCart)
    {
        return catCartMapper.selectCatCartList(catCart);
    }

    /**
     * 新增购物车信息
     * 
     * @param catCart 购物车信息
     * @return 结果
     */
    @Override
    public int insertCatCart(CatCart catCart)
    {
        catCart.setCreateTime(DateUtils.getNowDate());
        return catCartMapper.insertCatCart(catCart);
    }

    /**
     * 修改购物车信息
     * 
     * @param catCart 购物车信息
     * @return 结果
     */
    @Override
    public int updateCatCart(CatCart catCart)
    {
        catCart.setUpdateTime(DateUtils.getNowDate());
        return catCartMapper.updateCatCart(catCart);
    }

    /**
     * 批量删除购物车信息
     * 
     * @param cartids 需要删除的购物车信息主键
     * @return 结果
     */
    @Override
    public int deleteCatCartByCartids(Long[] cartids)
    {
        return catCartMapper.deleteCatCartByCartids(cartids);
    }

    /**
     * 删除购物车信息信息
     * 
     * @param cartid 购物车信息主键
     * @return 结果
     */
    @Override
    public int deleteCatCartByCartid(Long cartid)
    {
        return catCartMapper.deleteCatCartByCartid(cartid);
    }
}
